home *** CD-ROM | disk | FTP | other *** search
- Path: grafix.xs4all.nl!john.hendrikx
- Date: Sun, 07 Jan 96 15:33:47 GMT+1
- Newsgroups: comp.sys.amiga.programmer
- Distribution: world
- Subject: Re: Amiga programmers in deep shit...
- MIME-Version: 1.0
- Content-Type: text/plain; charset=iso-8859-1
- Content-Transfer-Encoding: 8bit
- From: john.hendrikx@grafix.xs4all.nl (John Hendrikx)
- Message-ID: <john.hendrikx.44q7@grafix.xs4all.nl>
- Organization: Grafix Attack BBS Holland
-
- In a message of 07 Jan 96 Stephan Schaem wrote to All:
-
- >> You make it sound like that is impossible, while it really isn't given
- >> the right situation:
-
- >> - Game leaves about 10-20% CPU time free.
-
- SS> per frame, yes.
-
- Of course :-)
-
- >> - Use small Read()'s and Write()'s (experiment; there is no rush to
- >> load the level-data right? It will be faster than floppy's even
- >> if you use 512-byte read/writes :-))
-
- SS> I dont mind reading 512k byte at a time... My guess is that even
- SS> if the device has the data cached it will be too slow. so imagine
- SS> when it will read a next full block from the HW device. On dataflyer
- SS> and such controler the game would shudder.
-
- Okay, just for you I wrote a test-program to prove it is possible. Right now a
- test-program is running which reads 512 bytes from my IDE drive every VBlank.
- According to Spy the TOTAL CPU time used by my system right now is between 11
- and 14% (I've got a 68030/22). This time is distributed among the following
- tasks like this:
-
- SoftSCSI_ATEA.device 2.8%
- DH1 2.6%
- DoLotsOfSmallReads 1.5%
- DisplaySpy 1.2% (the program displaying a CPU-time graph)
- input.device 1.1%
- TopCPU 0.5% (the program which displayed these values)
- BOOT:C/SMouse 0.3% (my wb-titlebar clock program)
-
- Only the first 3 are the ones involved with reading the data from the HD (the
- SCSI-device, the filesystem and the program performing the reads).
-
- The DoLotsOfSmallReads program consists of nothing more than this:
-
- do {
- WaitTOF();
- Read(fh,&buffer,512);
- } while(result==512)
-
- (I wrote it in ASM so the code above may not be correct :-) I used ASM because
- I had to do several tests, and I don't want to wait 2 minutes for every
- re-compile :-))
-
- My Blanker running at Pri -120 sees no negative influence at all and it runs as
- smooth as ever.
-
- Note that -normally- when I use my IDE drive EVERYTHING grinds to a halt, if I
- remove the WaitTOF() call then my IDE drive will eat all CPU time.
-
- Okay, here are some more results (CPU time used under the same circumstances as
- above):
-
- controller | 512 bytes/frame | 4096 bytes/frame
- ----------------------------------------------------------------
- SCSI (gvpscsi.device, DMA) | 15-17% | 17-18%
- IDE (oktagon IDE) | 11-14% | 22-26%
- ----------------------------------------------------------------
-
- You can see that a DMA controller really makes a difference but that in general
- you shouldn't have to worry about even non-DMA controllers taking too much CPU
- time if you keep the block size small enough.
-
- If you use block sizes somewhere between 512 and 4096 bytes I think you'll get
- very nice reading speeds without noticing a thing.
-
- Throughput speeds (untested):
-
- 512 bytes/frame = 25K/s
- 4096 bytes/frame = 200K/s
-
- >> This should work even on non-DMA controllers. Of course the game should
- >> be multitasking, run at a pri less than 5 or so and generally 'behave'.
- >> Current games hardly fit this description but that doesn't make 'smooth'
- >> HD access impossible.
-
- SS> If one can read 512byte continously in ~25 raster using read() on a
- SS> non dma controler , I would say yes too. triple bufffer could 'smooth'
- SS> the possible sporatic behaviour of the read()/device/HW.
-
- Well, see above :-)
-
- SS> I dont think I want to try that anyway :) You have an HD? you must
- SS> have
- SS> 1extra meg compare to the floppy user, let me preload...
- SS> If this can work on HD, you could reserve space to decompress an audio
- SS> mpeg file and play it back during the game... An example for game
- SS> designed only for HD user. VS floppy & HD
-
- As you can see above it ain't really necessary, if you can spare a bit of CPU
- time. Even with 1K or 2K block reads every frame you still beat floppies by a
- long way, and without any noticeable slow-downs.
-
- Grtz John
-
- -----------------------------------------------------------------------
- John.Hendrikx@grafix.xs4all.nl TextDemo/FastView/Etc... development
- -----------------------------------------------------------------------
- -- Via Xenolink 1.981, XenolinkUUCP 1.1
-